<%@ page language="java" contentType="text/html; charset=UTF-8"
	pageEncoding="UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/default/easyui.css"/>">
<link rel="stylesheet" type="text/css"
	href="<c:url value="/css/themes/icon.css"/>">
<script type="text/javascript" src="<c:url value="/js/jquery.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery-3.1.1.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/jquery.easyui.min.js"/>"></script>
<script type="text/javascript"
	src="<c:url value="/js/easyui-lang-zh_CN.js"/>"></script>
<title>检查服务</title>
<style type="text/css">
.cc_item {
	padding: 10px;
}
</style>
</head>
<body>
<script>
		var cc_patientCleckcolumns = [[
    		{field:'echeckid',width:'6%',checkbox:true,title:'检查编号'},
   		    {field:'staffName',width:'20%',title:'检查安排人'},
    		{field:'echeckName',width:'21%',title:'检查名称'},
    		{field:'pname', width:'20%',title:'检查的病人'},
    		{field:'he_date',width:'18%',title:'安排时间'},
   		    {field:'checkrameks', width:'18%',title:'检查状态'}
        ]];
		</script>
<script type="text/javascript">
	$(function(){
		var  shenpi_staffId = $("#tontyiStaffId").html();
		//cc_patientcheck_reload刷新
		$("#cc_patientcheck_reload").linkbutton({
			onClick:function(){
				$("#cc_show_patientcheck_pd").propertygrid({
					url:'cc_toqueryByAllEleCheck'
				});
				$("#cc_show_patientcheck_pd").propertygrid({
					groupField:'echeckName'
				});
			}
		});

		//cc_toqueryByEleCheckicid
		$("#cc_patientcheck_searchbox").searchbox({
			searcher : function(value, name) {
				if (name == "医疗卡号") {
					$("#cc_show_patientcheck_pd").propertygrid({
						url : 'cc_toqueryByEleCheckicid',
						queryParams : {
							icid : value
						}
					});
				}
			}
		});
		//调整
		$("#cc_patientcheck_tiaozheng").linkbutton({
			onClick:function(){
				$("#cc_show_patientcheck_pd").propertygrid({
					groupField:'he_date'
				});
			}
		});
		//处理
		var echeckid; 
		$("#cc_patientcheck_ok").linkbutton({
			onClick:function(){
				
				var rows=$("#cc_show_patientcheck_pd").propertygrid("getSelections");
				if(rows.length==1){
					if(rows[0].checkrameks!='已完成'){
						echeckid=rows[0].echeckid;
						$("#cc_patientcheck_fileid").val(rows[0].echeckid);
						$("#cc_patientcheckfilewin").window('open');
					}else{
						$.messager.alert("提示", "此项检查已经完成!");
					}
				}else{
					$.messager.alert("提示", "只能选择一条记录，您目前选择了"+ rows.length + "条!");
				}
			}
		});
		$("#cc_patientcheck_fileupload").linkbutton({
			onClick:function(){
				$('#cc_patientcheck_fileform').form('submit', {
					onSubmit : function(param) {
						 //返回true提交表单，返回false则阻止表单提交
			             return $(this).form('validate');
					},
					success : function() {
						//JSON字符串两边需要添加小括号
						//var json = eval( "("+ data+")" );
						$.messager.alert("提示", "提交完成！");
						//关闭窗口
						$('#cc_patientcheckfilewin').window('close');
						
						//重新加载数据
						$("#cc_show_patientcheck_pd").datagrid("reload");
						$(this).form("clear");
					}
				});
			}
		});
		$("#cc_patientcheck_fileuploadcancel").linkbutton({
			onClick:function(){
				$("#cc_patientcheckfilewin").window('close');
				$("#cc_patientcheck_fileform").form('clear');
				
			}
		});
			
	});
	function cc_pcheckrowStlye(index,row){
		//alert(new Date());
		var date = new Date();
	    var seperator1 = "/";
	    var month = date.getMonth() + 1;
	    var strDate = date.getDate();
	    if (month >= 1 && month <= 9) {
	        month = "0" + month;
	    }
	    if (strDate >= 0 && strDate <= 9) {
	        strDate = "0" + strDate;
	    }
	    var currentdate = date.getFullYear() + seperator1 + month + seperator1 + strDate;
	    if (row.he_date==currentdate&&row.checkrameks!="已完成"){
			return 'background-color:#CCFF99;color:red;';
		}
	}
</script>

	<table id="cc_show_patientcheck_pd" class="easyui-propertygrid"
		data-options="
						fitColumns:true,
						fit:true,
						showGroup:true,
						striped:true,
						pagination:true,
						url:'cc_toqueryByAllEleCheck',
						toolbar:'#cc_patientcheck_btn',
						pageSize: 16,
						pageList:[16,32,64,128],
						border:false,
						columns: cc_patientCleckcolumns,
						groupField:'echeckName',
						rowStyler: cc_pcheckrowStlye
			">
	</table>
	
	<div id="cc_patientcheck_btn">
			<a id="cc_patientcheck_ok" class="easyui-linkbutton"
			data-options="iconCls:'icon-ok',plain:true">完成检查</a>
			<a id="cc_patientcheck_tiaozheng" class="easyui-linkbutton"
			data-options="iconCls:'icon-tiaozheng',plain:true">切换分组</a>
			<a id="cc_patientcheck_reload" class="easyui-linkbutton"
			data-options="iconCls:'icon-reload',plain:true">刷新</a>
			<input id="cc_patientcheck_searchbox" class="easyui-searchbox"
			data-options="menu:'#cc_eeeeee',width:220,prompt:'请输入你要查找的内容'">
	</div>
	<div id="cc_eeeeee" style="width: 90px">
		<div date-options="name:'name'">医疗卡号</div>
	</div>
	<div id="cc_patientcheckfilewin" class="easyui-window" 
	title="上传检查结果" style="width:240px;height:120px;background: rgb(236,243,255);"   
        data-options="iconCls:'icon-save', modal:true,closed: true">   
	    <form id="cc_patientcheck_fileform"  action="tocc_hospelecheckok"
	      method="post"  enctype="multipart/form-data">
	    	<div style="display: none;">
	    		<input id="cc_patientcheck_fileid" name="elecheckid">
	    	</div> 
		    <div style="margin-left:20px">   
		         <input class="easyui-filebox" name="file"
		          label="检查结果：" labelPosition="top" 
		          data-options="prompt:'请选择结果',
		          buttonText:'选择文件',
		          required: true" style="width:90%">
		    </div>
		    <div style="margin-left:15%;margin-top: 5px">
	            <a id="cc_patientcheck_fileupload"  class="easyui-linkbutton" data-options="iconCls:'icon-baocun'">确定</a>
				<a id="cc_patientcheck_fileuploadcancel" style="margin-left:40px" class="easyui-linkbutton" data-options="iconCls:'icon-chexiao'">取消</a>
			</div>
		</form> 
	</div>  
</body>
</html>